<?php
C_base::yn_file('base'.DS.'htmlbase.php');
class ruser extends htmlbase{
	
	var $_vpath = 'ruser/';//pc/phone文件夹下的路径
	var $ruid;//个人登录用户id
	var $_waiyu = array('不限','英语','日语','法语','韩语','德语','泰语','西班牙语','俄语','意大利语','葡萄牙语','斯瓦西里语','阿拉伯语','马来语','瑞典语','塞尔威亚语','波斯语','越南语','芬兰语','乌克兰语','捷克语','阿尔巴尼亚语','波兰语','缅甸语','僧伽罗语','豪萨语','印地语');
	var $_wyjb = array('精通','熟练','一般');//外语级别
	var $_xueli = array('不限','高中以下','高中','中专/技校','大专','本科','硕士','博士','MBA/EMBA');
	var $_gzjy = array('应届生','一年','两年','三年','三年-五年','五年-十年','十年以上');
	var $_danwei = array('元/小时','元/天','元/周','元/月');
	var $_youxiao = array('一周','两周','一月','两月','三月','半年','一年','两年','长期有效');
	var $_sex = array('保密','男','女');
	var $_hyzt = array('未婚','已婚');
	var $_shenfen = array('在校学生','社会人才');
	var $_qyxz = array('外资','合资','国有','集体','私营','股份');
	var $_yxfw = array('面议','1000元以下','1000-2000元','2000-3000元','3000-5000元','5000-8000元','8000-10000元','10000元以上');
	var $_qzzk = array('请选择','我现在已离职,可以立刻上岗','如果有好的机会,我愿意考虑','我现在在职,上岗需要一个月左右');//求职状况
	
	function __construct(){
		parent::__construct();
		$this->ruid = @$this->Ses('recruit_uid') ? $this->Ses('recruit_uid') : '';
	}
	
	function sfdl_user(){//判断是否登录
		if(!@$this->ruid){
			$this->_alert_location($this->_url.'/?act=ruser&met=login','请先登录');
		}else{
			$cha = C_base::M('admin.recruit')->user_s(array('id'=>$this->ruid,'lx'=>0));
			if(@$cha['dongjie'] == 1){//用户被冻结
				$this->_alert_location($this->_url.'/?act=ruser&met=login','账号被冻结，不能登录');
			}
		}
	}
	
/***************************************************注册、登录、退出***************************************************/
	function zcyx(){//注册-邮箱
		$this->title='注册-邮箱';
	}
	
	function zcsj(){//注册-手机
		$this->title='注册-手机';
	}
	
	function yzm_u($post){
		$this->_is_html=1;
		extract($post);
		$w=array('zhanghao'=>$zhanghao);
		$ww=C_base::M('admin.base')->yzm_s($w);
		if($ww){
			$aa=C_base::M('admin.base')->yzm_u($w,$post);
		}else{
			$aa=C_base::M('admin.base')->yzm_c($post);
		}
		return $aa;
	}
	
	function fsyzm(){//发送验证码
		$this->_is_html=1;
		extract($this->_post());
		if(!@$name){
			exit('请填写账号');
		}
		if(@$lx == 1){//找回密码
			if($type == 1){//手机
				$w = array('phone'=>$name);
			}elseif($type == 2){//邮箱
				$w = array('email'=>$name);
			}else{
				exit('非法操作');
			}
			$user = C_base::M('admin.recruit')->user_s($w);
			if(!$user){
				exit('请正确填写账号');
			}
		}elseif(@$lx == 2){//修改手机/邮箱验证
			$this->sfdl_user();
			if($type == 1){//修改邮箱验证手机
				$user = C_base::M('admin.recruit')->user_s(array('id'=>$this->ruid,'phone'=>$name));
			}elseif($type == 2){//修改手机验证邮箱
				$user = C_base::M('admin.recruit')->user_s(array('id'=>$this->ruid,'email'=>$name));
			}else{
				exit('非法操作');
			}
			if(!$user){
				exit('账号错误');
			}
		}elseif(@$lx == 3){//修改手机/邮箱
			$this->sfdl_user();
			if($type == 1){//手机
				$w = array('phone'=>$name);
			}elseif($type == 2){//邮箱
				$w = array('email'=>$name);
			}else{
				exit('非法操作');
			}
			$user = C_base::M('admin.recruit')->user_s($w);
			if(@$user){
				exit('此账号已存在');
			}
		}else{
			if($type == 1){//手机
				$w = array('phone'=>$name);
			}elseif($type == 2){//邮箱
				$w = array('email'=>$name);
			}else{
				exit('非法操作');
			}
			$user = C_base::M('admin.recruit')->user_s($w);
			if(@$user){
				exit('此账号已存在');
			}
		}
		if(($type == 1 && util::preg_phone($name)) || ($type == 2 && util::preg_email($name))){//验证账号是否合法
			$cha = C_base::M('admin.base')->yzm_s(array('zhanghao'=>$name));
			if(@$cha && (@$cha['time']+60) > time()){
				exit('对不起， 发送验证码时间间隔不能少于60秒');
			}
			$yzm=util::rand_sum('9',6);  //验证码
			if(@$lx == 1){
				$tj = array('uid'=>$user['id'],'zhanghao'=>$name,'yzm'=>$yzm,'time'=>time());
			}elseif(@$lx == 2 || @$lx == 3){
				$tj = array('uid'=>$this->ruid,'zhanghao'=>$name,'yzm'=>$yzm,'time'=>time());
			}else{
				$tj = array('zhanghao'=>$name,'yzm'=>$yzm,'time'=>time());
			}
			$zz=$this->yzm_u($tj);
			if($zz){
				$content='您本次的验证码为'.$yzm.'，有效时间：120秒。';
				if($type == 1){
					$args = array('shouji'=>$name,'content'=>$content,'yzm'=>$yzm);
					$aa=util::shouji_send($args);
				}else{
					$args = array('email'=>$name,'content'=>$content,'nickname'=>$name,'title'=>'邮箱注册验证');
					$aa=util::mail_send($args);
				}
				if($aa){
					exit('发送成功');
				}else{
					exit('发送失败');
				}
			}else{
				exit('系统繁忙');
			}
		}else{
			exit('请正确填写账号');
		}
	}
		
	function zhuce(){//注册
		$this->_is_html=1;
		extract($this->_post());
		if(!@$name){
			exit('请填写账号');
		}elseif(!@$yzm){
			exit('请填写验证码');
		}elseif(!@$pass || !@$npass){
			exit('请填写密码');
		}elseif(!@$tytk){//同意条款
			exit('请勾选同意条款');
		}
		if($type == 1){//手机
			$w = array('phone'=>$name);
		}elseif($type == 2){//邮箱
			$w = array('email'=>$name);
		}else{
			exit('非法操作');
		}
		$user = C_base::M('admin.recruit')->user_s($w);
		if(!@$user){
			if(($type == 1 && util::preg_phone($name)) || ($type == 2 && util::preg_email($name))){//验证账号是否合法
				if(!util::preg_pass($pass)){
					exit('请正确填写密码，密码由字母和数字组合且长度在6-12个字符之间');
				}elseif($pass != $npass){
					exit('两次密码不一致');
				}else{
					$yz = C_base::M('admin.base')->yzm_s(array('zhanghao'=>$name,'yzm'=>$yzm));
					if(@$yz){
						if((@$yz['time']+120) < time()){//如果验证码超过120秒，则失效
							exit('验证码已失效，请重新验证');
						}else{
							if($type == 1){//手机
								$c = array('phone'=>$name,'pass'=>md5($pass),'type'=>$type,'time'=>time(),'dltime'=>time());//写入用户信息
							}elseif($type == 2){//邮箱
								$c = array('email'=>$name,'pass'=>md5($pass),'type'=>$type,'time'=>time(),'dltime'=>time());//写入用户信息
							}
							$a = C_base::M('admin.recruit')->user_c($c);
							if($a){
								C_base::M('admin.base')->yzm_d(array('id'=>$yz['id']));
								exit('注册成功');
							}else{
								exit('系统繁忙');
							}
						}
					}else{
						exit('验证码错误');
					}
				}
			}else{
				exit('请正确填写账号');
			}
		}else{
			exit('此账号已存在');
		}
	}
	
	function login(){
		$this->title='登录';
	}
	
	function logincg(){
		$this->title = '登录成功';
		$this->sfdl_user();
		//简历完整度。全职简历第一份完整度，全职简历字段为20个
		$this->resume = $this->resume_wzd($this->ruid);
	}
	
	function denglu(){//个人登录
		$this->_is_html=1;
		extract($this->_post());
		if(!@$name){
			exit('请输入用户名');
		}elseif(!@$pass){
			exit('请输入密码');
		}
		$cha = C_base::M('admin.recruit')->user_s(array('phone'=>$name,'pass'=>md5($pass),'lx'=>0));
		if(!@$cha){
			$cha = C_base::M('admin.recruit')->user_s(array('email'=>$name,'pass'=>md5($pass),'lx'=>0));
		}
		if(@$cha){
			if($cha['dongjie'] == 1){
				exit('账号被冻结，不能登录');//用户被冻结
			}else{
				C_base::M('admin.recruit')->user_u(array('id'=>$cha['id']),array('id'=>$cha['id'],'dltime'=>time()));
				$this->Ses('recruit_uid',$cha['id']);//用户id
				$this->Ses('recruit_uname',$name);//用户名
				$this->Ses('recruit_type',1);//个人
				$this->Ses('recruit_zjid','');
				$this->Ses('firm_id','');
				if(@$remember){//如果用户选择了自动登录，就把用户名和密码放到cookie里面
					$this->cookie('recruit_name',$name);
					$this->cookie('recruit_pass',$pass);
				}
				exit('登录成功');
			}
		}else{
			exit('账号或密码错误');
		}
	}
	
	function tuichu(){//退出
		C_base::M('admin.recruit')->user_u(array('id'=>$this->ruid),array('socket_id'=>0));
		$this->Ses('recruit_uid','');
		$this->Ses('recruit_uname','');
		$this->Ses('recruit_type','');
		$this->Ses('recruit_qq','');//openid
		$this->_alert_location($this->_url.'/?act=ruser&met=login');
	}
	
/******************************************第三方QQ登录*****************************************************/
	function qq_login(){
		C_base::yn_file('base'.DS.'qq'.DS.'qqConnectAPI.php');
		$qc = new QC();
		$qc->qq_login();
	}
	
	function bdzh(){//第三方QQ登录后绑定账号
		$this->title='关联账号';
		if(!@$this->Ses('recruit_qq')){
			$this->_alert_location($this->_url.'/?act=ruser&met=login','请先登录');
		}
		$pd = C_base::M('admin.recruit')->user_s(array('openid'=>$this->Ses('recruit_qq')));
		if($pd){//绑定之后不需要再绑定
			$this->_alert_location($this->_url.'/?act=ruser&met=login','已绑定');
		}
	}
	
	function cjbd(){//创建并绑定账号
		$this->_is_html=1;
		$this->bdzh();
		extract($this->_post());
		if(!@$email){
			exit('请填写邮箱');
		}elseif(!@$eyzm){
			exit('请填写邮箱验证码');
		}elseif(!@$phone){
			exit('请填写手机');
		}elseif(!@$pyzm){
			exit('请填写手机验证码');
		}elseif(!@$pass){
			exit('请填写密码');
		}
		$yx = C_base::M('admin.recruit')->user_s(array('email'=>$email));
		$sj = C_base::M('admin.recruit')->user_s(array('phone'=>$phone));
		if(@$yx || @$yx['lx'] != 0){
			exit('此邮箱已存在');
		}elseif(@$sj || @$sj['lx'] != 0){
			exit('此手机已存在');
		}else{
			if(($phone && util::preg_phone($phone)) || ($email && util::preg_email($email))){//验证账号是否合法
				if(!util::preg_pass($pass)){
					exit('请正确填写密码，密码由字母和数字组合且长度在6-12个字符之间');
				}else{
					$yz = C_base::M('admin.base')->yzm_s(array('zhanghao'=>$phone,'yzm'=>$pyzm));
					$yzy = C_base::M('admin.base')->yzm_s(array('zhanghao'=>$email,'yzm'=>$eyzm));
					if(@$yz && @$yzy){
						if((@$yz['time']+120) < time()){//如果验证码超过120秒，则失效
							exit('手机验证码已失效，请重新验证');
						}elseif((@$yzy['time']+120) < time()){
							exit('邮箱验证码已失效，请重新验证');
						}else{
							$c = array('openid'=>$this->Ses('recruit_qq'),'phone'=>$phone,'email'=>$email,'pass'=>md5($pass),'time'=>time(),'dltime'=>time());//写入用户信息
							$a = C_base::M('admin.recruit')->user_c($c);
							if($a){
								C_base::M('admin.base')->yzm_d(array('id'=>$yz['id']));
								C_base::M('admin.base')->yzm_d(array('id'=>$yzy['id']));
								$this->Ses('recruit_uid',$a);//用户id
								$this->Ses('recruit_uname',$phone);//用户名
								$this->Ses('recruit_type',1);//个人
								$this->Ses('recruit_zjid','');
								$this->Ses('firm_id','');
								exit('绑定成功');
							}else{
								exit('系统繁忙');
							}
						}
					}else{
						exit('验证码错误');
					}
				}
			}else{
				exit('请正确填写账号');
			}
		}
	}
	
	function bd(){//绑定账号
		$this->_is_html=1;
		$this->bdzh();
		extract($this->_post());
		$cha = C_base::M('admin.recruit')->user_s(array('phone'=>$name,'pass'=>md5($pass),'lx'=>0));
		if(!@$cha){
			$cha = C_base::M('admin.recruit')->user_s(array('email'=>$name,'pass'=>md5($pass),'lx'=>0));
		}
		if($cha){
			if($cha['openid'] && $cha['openid'] == $this->Ses('recruit_qq')){
				exit('已绑定成功');
			}elseif($cha['openid'] && $cha['openid'] != $this->Ses('recruit_qq')){
				exit('此账号已绑定了QQ');
			}else{
				$xiu = C_base::M('admin.recruit')->user_u(array('id'=>$cha['id']),array('openid'=>$this->Ses('recruit_qq')));
			}
			if($xiu){
				$this->Ses('recruit_uid',$cha['id']);//用户id
				$this->Ses('recruit_uname',$name);//用户名
				$this->Ses('recruit_type',1);//个人
				$this->Ses('recruit_zjid','');
				$this->Ses('firm_id','');
				exit('绑定成功');
			}else{
				exit('系统繁忙');
			}
		}else{
			exit('账号或密码错误');
		}
	}
	
/******************************************找回密码*****************************************************/	
	function zhmmsj(){
		$this->title = '手机找回密码';
		
	}
	
	function zhmmyx(){
		$this->title = '邮箱找回密码';
		
	}
	
	function zhaohui(){//找回密码
		$this->_is_html=1;
		extract($this->_post());
		if(!@$name){
			exit('请填写账号');
		}elseif(!@$yzm){
			exit('请填写验证码');
		}elseif(!@$pass || !@$npass){
			exit('请填写密码');
		}elseif(!util::preg_pass($pass)){
			exit('请正确填写密码，密码由字母和数字组合且长度在6-12个字符之间');
		}elseif($pass != $npass){
			exit('两次密码不一致');
		}
		if($type == 1){//手机
			$w = array('phone'=>$name);
		}elseif($type == 2){//邮箱
			$w = array('email'=>$name);
		}else{
			exit('非法操作');
		}
		$user = C_base::M('admin.recruit')->user_s($w);
		if(@$user){
			if($user['dongjie'] == 1){
				exit('此账号已冻结');
			}elseif(($type == 1 && util::preg_phone($name)) || ($type == 2 && util::preg_email($name))){//验证账号是否合法
				$yz = C_base::M('admin.base')->yzm_s(array('uid'=>$user['id'],'zhanghao'=>$name,'yzm'=>$yzm));
				if(@$yz){
					if((@$yz['time']+120) < time()){//如果验证码超过120秒，则失效
						exit('验证码已失效，请重新验证');
					}else{
						$a = C_base::M('admin.recruit')->user_u(array('id'=>$user['id']),array('pass'=>md5($pass)));
						if($a){
							C_base::M('admin.base')->yzm_d(array('id'=>$yz['id']));
							exit('重置成功');
						}else{
							exit('系统繁忙');
						}
					}
				}else{
					exit('验证码错误');
				}
			}else{
				exit('请正确填写账号');
			}
		}else{
			exit('请正确填写账号');
		}
	}
	
/**************************************************修改密码************************************************/
	function xgmm(){//修改密码
		$this->sfdl_user();
		$this->title = '修改密码';
		
	}
	
	function xgmm_yz(){//修改密码
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		$a = array('id'=>$this->ruid);
		$aa = C_base::M('admin.recruit')->user_s($a);
		if($aa['pass'] && !@$pass){
			exit('请填写原密码');
		}elseif($npass && $nnpass){
			if($aa['pass'] && $aa['pass'] != md5($pass)){
				exit('原密码错误');
			}elseif(!$aa['pass'] && $pass){
				exit('原密码错误');
			}else{
				if($npass == $nnpass){
					if($npass == $pass){
						exit('新密码不能与原密码相同');
					}elseif($npass == ''){
						exit('新密码不能为空');
					}elseif(!util::preg_pass($npass)){
						exit('请正确填写密码，密码由字母和数字组合且长度在6-12个字符之间');
					}else{
						$bb = C_base::M('admin.recruit')->user_u(array('id'=>$aa['id']),array('pass'=>md5($npass)));
						if(@$bb){
							$this->Ses('recruit_uid','');
							$this->Ses('recruit_uname','');
							$this->Ses('recruit_type','');
							exit('修改成功');
						}else{
							exit('修改失败');
						}
					}
				}else{
					exit('两次密码不一致');
				}
			}
		}else{
			exit('密码不能为空');
		}
	}
	
/**************************************************个人中心************************************************/
	function index(){//个人中心
		$this->sfdl_user();
		$this->title = '个人中心';
		$this->user = C_base::M('admin.recruit')->user_s(array('id'=>$this->ruid));
		$this->user['base'] = C_base::M('admin.recruit')->ubase_s(array('uid'=>$this->ruid));
		//收藏的职位5条
		$this->sc = $this->user_sc($this->ruid,1,5);
		//简历刷新时间
		$one = $this->one = $this->resume_one($this->ruid);//第一份简历
		$this->sxtime = @$one['utime'];
		//简历完整度。全职简历第一份完整度，全职简历字段为20个
		$this->resume = $this->resume_wzd($this->ruid);
		//用户统计信息
		$this->tj = C_base::M('admin.recruit')->tongji_s(array('uid'=>$this->ruid));
		//最新职位推荐随机10条
		$this->tuij = $this->user_tj($this->ruid);
		//最新文章/视频6条
		$new = $this->xuedy(array('zt'=>1));
		$this->wzsp = $this->xuers($new,1,6);
		
	}
	
	function resume_one($uid){//第一份简历
		return C_base::M('admin.recruit')->resume_s($uid,array('uid'=>$uid,'zt'=>0));
	}
	
	function resume_wzd($uid){//简历完整度
		$pd = $this->resume_one($uid);
		if($pd){
			$arr = util::quchu($pd,'id,uid,xshi,xqu,xsq,hkshi,hkqu,hk,shenfen,danwei,qzshi,qzqu,qzsq,youxiao,jztime,time,utime,type,zt');
			$bk = array_filter($arr,array($this,'kong'));//不空的数组元素
			$kk = count($bk)/count($arr)*100;//不空字段数/总字段数
			$wzd = round($kk).'%';
		}else{//不存在简历
			$wzd = '0%';
		}
		return $wzd;
	}
	
	function kong($v){//简历完整度调用
		if($v===''){//当数组中存在空值时，换回false
			return false;
		}else{
			return true;
		}
	}
	
/**************************************************修改信息************************************************/
	function xgzl(){//修改资料
		$this->sfdl_user();
		$this->title = '修改资料';
		$this->r = C_base::M('admin.recruit')->user_s(array('id'=>$this->ruid));
		$this->rs = C_base::M('admin.recruit')->ubase_s(array('uid'=>$this->ruid));
		$this->zhuany = C_base::M('admin.recruit')->major_ss(array('sid'=>0));
		$this->zhuanye = C_base::M('admin.recruit')->major_ss(array('sid'=>$this->rs['zhuanye']));
		$this->sh = C_base::M('admin.port')->linkage_ss(array('parent_id'=>'0'));//所有省列表
		if(@$this->rs['xsheng']){
			$this->shi = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['xsheng']));
			if(@$this->rs['xshi']){
				$this->qu = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['xshi']));
			}
		}
		if(@$this->rs['hksheng']){
			$this->hkshi = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['hksheng']));
			if(@$this->rs['hkshi']){
				$this->hkqu = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['hkshi']));
			}
		}
		
	}
	
	function pd_name($name,$len='30'){//名称判断
		$na = mb_ereg_replace('^(　| )+','', $name);//去除全角字符的空格
		$nam = mb_ereg_replace('(　| )+$','', $na);//去除全角字符的空格
		$cd=(strlen(trim($nam)) + mb_strlen(trim($nam),'UTF8'))/2;
		if(trim($nam)){
			if($cd > $len){
				$zi = $len/2;
				exit('名称不能超过'.$zi.'个字');
			}
		}else{
			exit('名称不能为空');
		}
	}
	
	function xgzl_pd($post){
		extract($post);
		$time = date('Y-m-d',time());//当前日期
		if(!@$name){
			exit('请填写姓名');
		}elseif(@$sex == ''){
			exit('请选择性别');
		}elseif(!@$cstime){
			exit('请填写出生日期');
		}elseif(@$cstime && ($cstime > $time)){
			exit('请正确填写出生日期');
		}elseif(!@$xsheng || !@$xshi || !@$xqu/*  || !@$xsq */){
			exit('请填写现居住地');
		}elseif(!@$hksheng || !@$hkshi || !@$hkqu/*  || !@$hk */){
			exit('请填写户籍地址');
		}elseif(!@$sfzh){
			exit('请填写身份证号');
		}elseif(!util::preg_sfzh($sfzh)){
			exit('身份证号格式错误');
		}elseif(!@$xueli){
			exit('请选择学历');
		}elseif(!@$zhuanye){
			exit('请填写专业');
		}elseif(@$qq && !util::preg_qq($qq)){
			exit('qq格式错误');
		}elseif(@$name && !util::preg_name($name)){
			exit('请正确填写姓名');
		}
		$this->pd_name($name);
		if($xsq){
			$this->pd_name($xsq,60);
		}
		if($hk){
			$this->pd_name($hk,60);
		}	
		if(@$byyx){
			$this->pd_name($byyx,50);
		}
		if(@$zzmm){
			$this->pd_name($zzmm,6);
		}
	}
	
	function xgzl_yz(){//修改资料
		$this->_is_html=1;
		$this->sfdl_user();
		$post = $this->_post();
		extract($this->_post());
		$this->xgzl_pd($this->_post());
		if(@$cstime){
			$post['cstime'] = strtotime($cstime);
		}
		if(@$bytime){
			$post['bytime'] = strtotime($bytime);
		}
		$tj = array('uid'=>$this->ruid);
		$pd = C_base::M('admin.recruit')->ubase_s($tj);
		if($pd){
			$aa = C_base::M('admin.recruit')->ubase_u($tj,$post);
		}else{
			$c = array_merge($post,$tj);
			$aa = C_base::M('admin.recruit')->ubase_c($c);
		}
		if($aa){
			exit('修改成功');
		}else{
			exit('系统繁忙');
		}
	}
	
	function xgtx(){//修改头像
		$this->sfdl_user();
		$this->title = '上传头像';
		$this->rs = C_base::M('admin.recruit')->ubase_s(array('uid'=>$this->ruid));
	}
	
	function xgtx_yz(){//修改头像
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		if(!@$touxiang){
			exit('请选择上传照片');
		}
		$tj = array('uid'=>$this->ruid);
		$pd = C_base::M('admin.recruit')->ubase_s($tj);
		if($pd){
			$aa = C_base::M('admin.recruit')->ubase_u($tj,array('touxiang'=>$touxiang));
		}else{
			$c = array_merge(array('touxiang'=>$touxiang),$tj);
			$aa = C_base::M('admin.recruit')->ubase_c($c);
		}
		if($aa){
			exit('上传成功');
		}else{
			exit('系统繁忙');
		}
	}
	
	function xgsj(){//修改手机
		$this->title='修改手机';
		$this->sfdl_user();
		$this->rs = C_base::M('admin.recruit')->user_s(array('id'=>$this->ruid));
		
	}
	
	function xgyx(){//修改邮箱
		$this->title='修改邮箱';
		$this->sfdl_user();
		$this->rs = C_base::M('admin.recruit')->user_s(array('id'=>$this->ruid));
		
	}
	
	function xgyz(){//修改手机/邮箱验证
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		if(!@$name){
			exit('请填写账号');
		}elseif(!@$type){
			exit('请选择验证方式');
		}elseif(!@$yzm){
			exit('请填写验证码');
		}
		if($type == 1){//手机
			$w = array('id'=>$this->ruid,'phone'=>$name);
		}elseif($type == 2){//邮箱
			$w = array('id'=>$this->ruid,'email'=>$name);
		}else{
			exit('非法操作');
		}
		$pd = C_base::M('admin.recruit')->user_s($w);
		if($pd){
			$yy = array('uid'=>$this->ruid,'zhanghao'=>$name,'yzm'=>$yzm);
			$yz = C_base::M('admin.base')->yzm_s($yy);
			if($yz){
				if((@$yz['time']+120) < time()){//如果验证码超过120秒，则失效
					exit('验证码已失效，请重新验证');
				}else{
					C_base::M('admin.base')->yzm_d(array('id'=>$yz['id']));
					if(@$lx == 1){//手机
						$this->Ses('recruit_user_sj',1);
					}elseif(@$lx == 2){//邮箱
						$this->Ses('recruit_user_yx',1);
					}
					exit('验证成功');
				}
			}else{
				exit('验证码错误');
			}
		}else{
			exit('账号错误');
		}
	}
	
	function xgtj(){//修改手机/邮箱提交
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		$user = C_base::M('admin.recruit')->user_s(array('id'=>$this->ruid));
		if(!@$type){
			exit('非法操作');
		}elseif(@$user['phone'] && ($type == 1) && !@$this->Ses('recruit_user_sj')){
			exit('非法操作');
		}elseif(@$user['email'] && ($type == 2) && !@$this->Ses('recruit_user_yx')){
			exit('非法操作');
		}elseif(!@$name){
			exit('请填写账号');
		}elseif(!@$yzm){
			exit('请填写验证码');
		}elseif(($type == 1) && !util::preg_phone($name)){
			exit('手机格式错误');
		}elseif(($type == 2) && !util::preg_email($name)){
			exit('邮箱格式错误');
		}
		if($type == 1){//手机
			$w = array('phone'=>$name);
		}elseif($type == 2){
			$w = array('email'=>$name);
		}else{
			exit('非法操作');
		}
		$pd = C_base::M('admin.recruit')->user_s($w);
		if(!@$pd){
			$yy = array('uid'=>$this->ruid,'zhanghao'=>$name,'yzm'=>$yzm);
			$yz = C_base::M('admin.base')->yzm_s($yy);
			if($yz){
				if((@$yz['time']+120) < time()){//如果验证码超过120秒，则失效
					exit('验证码已失效，请重新验证');
				}else{
					C_base::M('admin.base')->yzm_d(array('id'=>$yz['id']));
					$t = array('id'=>$this->ruid);
					$xiu = C_base::M('admin.recruit')->user_u($t,$w);
					if($xiu){
						if($type == 1){//手机
							$this->Ses('recruit_user_sj','');
						}else{
							$this->Ses('recruit_user_yx','');
						}
						exit('修改成功');
					}else{
						exit('系统繁忙');
					}
				}
			}else{
				exit('验证码错误');
			}
		}else{
			if($pd['id'] == $this->ruid){
				exit('新账号不能和原账号相同');
			}else{
				exit('此账号已存在');
			}
		}
	}
	
/**************************************************简历管理************************************************/
	function resume(){//我的简历
		$this->sfdl_user();
		$this->title = '管理简历';
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 5;
		//用户统计信息
		$this->tj = C_base::M('admin.recruit')->tongji_s(array('uid'=>$this->ruid));
		//全职简历
		$this->quan = C_base::M('admin.recruit')->resume_ss($this->ruid,array('uid'=>$this->ruid,'zt'=>0));
		//兼职简历
		$this->jian = C_base::M('admin.recruit')->resume_ss($this->ruid,array('uid'=>$this->ruid,'zt'=>1),$page,$pagesize);
		if(@$this->jian['data']){
			foreach ($this->jian['data'] as $k=>$v){
				$this->jian['data'][$k]['zwname']=$this->user_zw($v['zwlb']).'('.$this->user_zw($v['zhiwei']).')';
			}
		}
	}
	
	function resume_tj(){//创建简历
		$this->sfdl_user();
		$this->title = '创建简历';
		
	}
	
	function resume_cj(){//创建简历
		$this->sfdl_user();
		$this->title = '创建简历';
		$ck = C_base::M('admin.recruit')->ubase_s(array('uid'=>$this->ruid));
		if(!@$ck){
			$this->_alert_location($this->_url.'/?act=ruser&met=xgzl','请先完善个人信息');
		}
		$this->zt = $zt = @$this->_get('zt') ? $this->_get('zt') : 0;
		if(@$this->_get('id')){//复制简历创建
			$this->rs = C_base::M('admin.recruit')->resume_s($this->ruid,array('uid'=>$this->ruid,'id'=>$this->_get('id')));
			if(!@$this->rs){
				$this->_cuowu('非法操作');
			}
			if(@$this->rs['zwlb']){
				$this->zhiwei = C_base::M('admin.recruit')->job_ss(array('sid'=>$this->rs['zwlb']));
			}
			if(@$this->rs['qzsheng']){
				$this->qzshi = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['qzsheng']));
				if(@$this->rs['qzshi']){
					$this->qzqu = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['qzshi']));
				}
			}
		}else{
			$r = C_base::M('admin.recruit')->user_s(array('id'=>$this->ruid));
			$this->rs = C_base::M('admin.recruit')->ubase_s(array('uid'=>$this->ruid));
			$this->rs['phone'] = @$r['phone'];
			$this->rs['email'] = @$r['email'];
		}
		$this->zwlb = C_base::M('admin.recruit')->job_ss(array('sid'=>0));
		$this->zhuany = C_base::M('admin.recruit')->major_ss(array('sid'=>0));
		$this->sh = C_base::M('admin.port')->linkage_ss(array('parent_id'=>'0'));//所有省列表
		if(@$this->rs['xsheng']){
			$this->shi = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['xsheng']));
			if(@$this->rs['xshi']){
				$this->qu = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['xshi']));
			}
		}
		if(@$this->rs['hksheng']){
			$this->hkshi = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['hksheng']));
			if(@$this->rs['hkshi']){
				$this->hkqu = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['hkshi']));
			}
		}
		
	}
	
	function resume_cjcg(){
		$this->title = '创建简历';
		$this->sfdl_user();
		if(!@$this->_get('id')){
			$this->_cuowu('非法操作');
		}
		$this->id = @$this->_get('id');
	}
	
	function resume_pd($post){//简历判断
		extract($post);
		$time = date('Y-m-d',time());//当前日期
		if(!@$name){
			exit('请填写姓名');
		}/* elseif(!@$touxiang){
			exit('请选择头像');
		} */elseif(@$sex == ''){
			exit('请选择性别');
		}elseif(!@$minzu){
			exit('请填写民族');
		}elseif(!@$cstime){
			exit('请填写出生日期');
		}elseif(@$cstime && ($cstime > $time)){
			exit('请正确填写出生日期');
		}elseif(!@$xsheng || !@$xshi || !@$xqu/*  || !@$xsq */){
			exit('请填写现居住地');
		}elseif(!@$hksheng || !@$hkshi || !@$hkqu/*  || !@$hk */){
			exit('请填写户籍地址');
		}elseif(!@$zhuanye){
			exit('请填写专业');
		}elseif(!@$qtzhuanye){
			exit('请填写二级专业');
		}elseif(!@$xueli){
			exit('请填写学历');
		}elseif(!@$shengao){
			exit('请填写身高');
		}elseif(!@$tizhong){
			exit('请填写体重');
		}elseif(!@$phone){
			exit('请填写手机号');
		}elseif(@$zt == 1 && @$shenfen == ''){
			exit('请选择我的身份');
		}elseif(@$zt != 1 && @$gzjy == ''){
			exit('请选择工作经验');
		}elseif(@$zt != 1 && !@$title){
			exit('请填写简历标题');
		}elseif(!@$zwlb){
			exit('请选择职位类别');
		}elseif(!@$zhiwei){
			exit('请选择职位类别');
		}elseif(!@$money){
			exit('请填写期望薪资');
		}elseif(!@$qzsheng || !@$qzshi){
			exit('请填写求职地区');
		}elseif(@$zt == 1 && @$youxiao == ''){
			exit('请填写有效期');
		}elseif(@$zt == 1 && !@$jztime){
			exit('请选择兼职时间');
		}elseif(@$shengao && !@is_numeric($shengao)){
			exit('身高必须为数字格式');
		}elseif(@$tizhong && !@is_numeric($tizhong)){
			exit('体重必须为数字格式');
		}elseif(@$email && !util::preg_email($email)){
			exit('邮箱格式错误');
		}elseif(@$phone && !util::preg_phone($phone)){
			exit('手机号格式错误');
		}elseif(@$money && !@is_numeric($money)){
			exit('薪资必须为数字格式');
		}elseif(@$name && !util::preg_name($name)){
			exit('请正确填写姓名');
		}elseif(empty($biye)){
			exit('请填写毕业院校');
		}elseif(empty($gzjl)){
			exit('请填写工作经历');
		}elseif(empty($jypx)){
			exit('请填写教育培训经历');
		}elseif(empty($qzzk)){
			exit('请选择求职状况');
		}
		if($name){
			$this->pd_name($name);
		}
		if($minzu){
			$this->pd_name($minzu,10);
		}
		if($xsq){
			$this->pd_name($xsq,60);
		}
		if($hk){
			$this->pd_name($hk,60);
		}
		if(@$jieshao){
			$this->pd_name($jieshao,1000);
		}
		if(@$title){
			$this->pd_name($title,40);
		}
		/* if(@$qzsq){
			$this->pd_name($qzsq,60);
		} */
		if(@$gzjl){
			$this->pd_name($gzjl,1600);
		}
	}
	
	function resume_add(){//创建简历
		$this->_is_html=1;
		$this->sfdl_user();
		$post = $this->_post();
		extract($this->_post());
		if(@$cstime){
			$post['cstime'] = strtotime($cstime);
			$post['age'] = util::time_age($post['cstime']);
		}
		$this->resume_pd($this->_post());
		if(@$zt != 1){//全职
			$tj = array('uid'=>$this->ruid);
			$pd = C_base::M('admin.recruit')->tongji_s($tj);
		}
		if(@$zt != 1 && @$pd && $pd['quanzhi'] > 4){
			exit('最多只能创建5个简历');
		}else{
			$c = array_merge($post,array('uid'=>$this->ruid,'time'=>time(),'utime'=>time()));
			$aa = C_base::M('admin.recruit')->resume_c($this->ruid,$c);
		}
		if($aa){
			if(@$zt == 1){//兼职
				$ziduan = 'jianzhi';
			}else{//全职
				$ziduan = 'quanzhi';
			}
			$this->user_tongji(array('uid'=>$this->ruid,'ziduan'=>$ziduan,'type'=>'+'));
			exit($this->_url.'/?act=ruser&met=resume_cjcg&id='.$aa);
		}else{
			exit('系统繁忙');
		}
	}
	
	/**
	 * GET
	 * uid 用户id（不传此项是自己查看自己简历）
	 * id 简历id
	 */
	function resume_look(){//查看简历
		if(!@$this->_get('uid') || (@$this->_get('uid') && @$this->_get('uid') == $this->ruid)){
			$this->sfdl_user();
		}
		$this->title = '查看简历';
		if(@$this->_get('id')){
			$uid = @$this->_get('uid') ? $this->_get('uid') : $this->ruid;
			$w = array('id'=>$this->_get('id'),'uid'=>$uid);
			$this->rs = C_base::M('admin.recruit')->resume_s($uid,$w);
			if($this->rs){
				if(@$this->Ses('firm_id')){
					$jlxz = C_base::M('admin.recruit')->jlxz_s($this->Ses('firm_id'),array('jlid'=>$this->_get('id'),'uid'=>$uid,'qid'=>$this->Ses('firm_id'),'lx'=>0));
				}elseif(@$this->Ses('recruit_zjid')){
					$jlxz = C_base::M('admin.recruit')->jlxz_s($this->Ses('recruit_zjid'),array('jlid'=>$this->_get('id'),'uid'=>$uid,'qid'=>$this->Ses('recruit_zjid'),'lx'=>1));
				}
				if($jlxz){
					$this->jlxz = 1;
				}else{
					$this->jlxz = 2;
				}
				$this->rs['age'] = util::time_age($this->rs['cstime']);
				$this->rs['xsheng'] = $this->user_dz($this->rs['xsheng']);
				$this->rs['xshi'] = $this->user_dz($this->rs['xshi']);
				$this->rs['xqu'] = $this->user_dz($this->rs['xqu']);
				$this->rs['hksheng'] = $this->user_dz($this->rs['hksheng']);
				$this->rs['hkshi'] = $this->user_dz($this->rs['hkshi']);
				$this->rs['hkqu'] = $this->user_dz($this->rs['hkqu']);
				$this->rs['qzsheng'] = $this->user_dz($this->rs['qzsheng']);
				$this->rs['qzshi'] = $this->user_dz($this->rs['qzshi']);
				$this->rs['qzqu'] = $this->user_dz($this->rs['qzqu']);
				$this->rs['zwlb'] = $this->user_zw($this->rs['zwlb']);
				$this->rs['zhiwei'] = $this->user_zw($this->rs['zhiwei']);
				$this->rs['zhuanye'] = $this->user_zy($this->rs['zhuanye']);
				if($this->rs['zhuanye'] != 576){
					$this->rs['qtzhuanye'] = $this->user_zy($this->rs['qtzhuanye']);
				}
				//培训经历
				$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
				$pagesize = $this->pagesize = 10;
				$this->rs['pxjl'] = $this->ckpxjl($uid,$page,$pagesize);
				$this->rscount = C_base::M('admin.recruit')->look_n($uid,array('uid'=>$uid));
				if($uid != $this->ruid){//如果是企业或专家查看，可以看专家面试意见选项
					$this->rs['view'] = $this->ckview($uid);
					if(@$this->Ses('recruit_zjid')){ //专家 未读修已读 专家未读简历数-1
						$ww = array('zjid'=>$this->Ses('recruit_zjid'),'jid'=>$this->_get('id'),'uid'=>$uid,'zt'=>0);
						$czjl =  C_base::M('admin.recruit')->vtoudi_s($this->Ses('recruit_zjid'),$ww);
						if(@$czjl){
							self::vtoudi_zt($czjl);
							//C_base::M('admin.recruit')->vtoudi_u($this->Ses('recruit_zjid'),$ww,array('zt'=>1));
							C_base::M('admin.recruit')->zjtongji_u(array('zjid'=>$this->Ses('recruit_zjid')),array('jlwds-'=>1));
						}
					}
					if (@$this->Ses('firm_id')){
						$cx = C_base::M('admin.recruit')->qtoudi_s($this->Ses('firm_id'),array('qid'=>$this->Ses('firm_id')));
					}
				}
			}else{
				$this->_cuowu('非法操作');
			}
		}else{
			$this->_cuowu('非法操作');
		}
	}
	
	function resume_bj(){//修改简历
		$this->sfdl_user();
		$this->title = '修改简历';
		if(@$this->_get('id')){
			$w = array('id'=>$this->_get('id'),'uid'=>$this->ruid);
			$this->rs = C_base::M('admin.recruit')->resume_s($this->ruid,$w);
			if($this->rs){
				$this->zwlb = C_base::M('admin.recruit')->job_ss(array('sid'=>0));
				if(@$this->rs['zwlb']){
					$this->zhiwei = C_base::M('admin.recruit')->job_ss(array('sid'=>$this->rs['zwlb']));
				}
				$this->zhuany = C_base::M('admin.recruit')->major_ss(array('sid'=>0));
				$this->zhuanye = C_base::M('admin.recruit')->major_ss(array('sid'=>$this->rs['zhuanye']));
				$this->sh = C_base::M('admin.port')->linkage_ss(array('parent_id'=>'0'));//所有省列表
				if(@$this->rs['xsheng']){
					$this->shi = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['xsheng']));
					if(@$this->rs['xshi']){
						$this->qu = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['xshi']));
					}
				}
				if(@$this->rs['hksheng']){
					$this->hkshi = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['hksheng']));
					if(@$this->rs['hkshi']){
						$this->hkqu = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['hkshi']));
					}
				}
				if(@$this->rs['qzsheng']){
					$this->qzshi = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['qzsheng']));
					if(@$this->rs['qzshi']){
						$this->qzqu = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$this->rs['qzshi']));
					}
				}
				
			}else{
				$this->_cuowu('非法操作');
			}
		}else{
			$this->_cuowu('非法操作');
		}
	}
	
	function resume_xiu(){//修改简历
		$this->_is_html=1;
		$this->sfdl_user();
		$post = $this->_post();
		extract($this->_post());
		if(@$cstime){
			$post['cstime'] = strtotime($cstime);
			$post['age'] = util::time_age($post['cstime']);
		}
		if(!@$id){
			exit('非法操作');
		}else{
			$tj = array('id'=>$id,'uid'=>$this->ruid);
			$ck = C_base::M('admin.recruit')->resume_s($this->ruid,$tj);
			if($ck){
				$this->resume_pd(array_merge($this->_post(),array('zt'=>$ck['zt'])));
				$w = array('id'=>$id);
				$post['utime'] = time();
				$aa = C_base::M('admin.recruit')->resume_u($this->ruid,$w,$post);
				if($aa){
					exit('修改成功');
				}else{
					exit('系统繁忙');
				}
			}else{
				exit('非法操作');
			}
		}
	}
	
	function resume_sc(){//删除简历
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		if(@$id){
			$w = array('id'=>$id,'uid'=>$this->ruid);
			$pd = C_base::M('admin.recruit')->resume_s($this->ruid,$w);
			if($pd){
				$del = C_base::M('admin.recruit')->resume_d($this->ruid,array('id'=>$id));
				if($del){
					if(@$pd['zt'] == 1){//兼职
						$ziduan = 'jianzhi';
					}else{//全职
						$ziduan = 'quanzhi';
					}
					$this->user_tongji(array('uid'=>$this->ruid,'ziduan'=>$ziduan,'type'=>'-'));
					exit('删除成功');
				}else{
					exit('系统繁忙');
				}
			}else{
				exit('非法操作');
			}
		}else{
			exit('非法操作');
		}
	}
	
	function resume_sx(){//刷新简历
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		if(@$id){
			$pd = C_base::M('admin.recruit')->resume_s($this->ruid,array('id'=>$id,'uid'=>$this->ruid));
			if($pd){
				$w = array('id'=>$id);
				$aa = C_base::M('admin.recruit')->resume_u($this->ruid,$w,array('utime'=>time()));
				if($aa){
					exit('ok');
				}else{
					exit('系统繁忙');
				}
			}else{
				exit('非法操作');
			}
		}else{
			$w = array('uid'=>$this->ruid);
			if(@$zt != ''){
				$w['zt'] = $zt;
			}
			$pd = C_base::M('admin.recruit')->resume_ss($this->ruid,$w);
			if($pd){
				$aa = C_base::M('admin.recruit')->resume_u($this->ruid,$w,array('utime'=>time()));
				if($aa){
					exit('ok');
				}else{
					exit('系统繁忙');
				}
			}else{
				exit('暂无简历可刷新');
			}
		}
	}
	
	function resume_type(){
		$this->title = '简历公开方式';
		$this->sfdl_user();
		if(!@$this->_get('id')){
			$this->_cuowu('非法操作');
		}
		$this->id = @$this->_get('id');
		
	}
	
	function resume_lx(){//保密/开放
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		if(@$id && (@$type != '')){
			$pd = C_base::M('admin.recruit')->resume_s($this->ruid,array('id'=>$id,'uid'=>$this->ruid));
			if(@$pd){
				if($pd['type'] == $type){
					exit('ok');
				}else{
					$aa = C_base::M('admin.recruit')->resume_u($this->ruid,array('id'=>$id),array('type'=>$type));
					if($aa){
						exit('ok');
					}else{
						exit('系统繁忙');
					}
				}
			}else{
				exit('此简历不存在');
			}
		}else{
			exit('非法操作');
		}
	}
	
	function resume_html($rs,$uid){
		$wordStr = '
			<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
				<head>
				<xml><w:WordDocument><w:View>Print</w:View></xml>
				<STYLE>
				BR.page { page-break-after: always }
				</STYLE>
				<style>
				body{
					font-size:16px;
				}
				.icheck{
					margin: 7px 0;
				}
				.icheck th,.icheck td{
					width: 50px;
					line-height:24px;
					font-weight:normal;
					font-size:12px;
					border: 1px solid #d9d9d9;
					text-align: center;
					color: #585858;
				}
				.icheck th{
					background: #f4f4f4;
				}
				</style>
				</head><body>';
		$age = util::time_age($rs['cstime']);//年龄
		$name = $this->user_name($rs['uid']);//姓名
		$date['y'] = date('Y',$rs['cstime']);//生日-年
		$date['m'] = date('m',$rs['cstime']);//生日-月
		$xjzd = $this->user_dz($rs['xsheng']).' '.$this->user_dz($rs['xshi']).' '.$this->user_dz($rs['xqu']).' '.$rs['xsq'];//现居住地
		$hjdz = $this->user_dz($rs['hksheng']).' '.$this->user_dz($rs['hkshi']);//户籍地址
		$img = $this->_url.'/material/photo.php?id='.$rs['touxiang'];//头像地址
		$xueli = $this->_xueli[$rs['xueli']];//学历
		$zhuanye = $this->user_zy($rs['zhuanye']);//专业
		$qiuzhi = $this->user_dz($rs['qzsheng']).' '.$this->user_dz($rs['qzshi']).' '.$this->user_dz($rs['qzqu']).' '.$rs['qzsq'];//求职地区
		$zhiwei = $this->user_zw($rs['zwlb']).'('.$this->user_zw($rs['zhiwei']).')';//职位类别
		$zhuanjia = $this->ckview($uid);//专家意见
		$wordStr .=<<<EOF
<div style='layout-grid:15.6pt;width:100%;'>		
<p align=left style='text-align:left;tab-stops:366.0pt'>
	<b style='mso-bidi-font-weight:normal'>
		<span style='font-size:16.0pt;font-family:"微软雅黑","sans-serif"'>$name</span>
	</b>
</p>

<p style='tab-stops:366.0pt'>
	<b style='mso-bidi-font-weight:normal'>
		<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
			{$this->_sex[$rs['sex']]}&nbsp;&nbsp;{$age}岁
		</span>
	</b>
	<b style='mso-bidi-font-weight:normal'>
		<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
			({$date['y']}年{$date['m']}月)&nbsp;&nbsp;&nbsp;民族 : {$rs['minzu']}
		</span>
	</b>
</p>

<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
		现居住地 : $xjzd
	</span>
</p>

<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
		户籍地址 : $hjdz
	</span>
</p>

<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
		最高学历 : {$xueli}&nbsp;&nbsp;主修专业 : {$zhuanye}
	</span>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
		身高 : {$rs['shengao']}cm&nbsp;&nbsp;&nbsp;体重 : {$rs['tizhong']}kg
	</span>
</p>
EOF;
	if($rs['zt'] == 1){
		$wordStr .= '<p style="tab-stops:366.0pt"><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">我的身份:'.$this->_shenfen[$rs['shenfen']].'</span></p>';
	}else{
		if(@$rs['gzjy']){
			$wordStr .= '<p style="tab-stops:366.0pt"><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">工作经验:'.$this->_gzjy[$rs['gzjy']].'</span></p>';
		}
	}
	$wordStr .= <<<EOF
<p style='tab-stops:366.0pt;'>
	<span style='position:absolute;mso-ignore:vglayout;top:71px;z-index:251657216'>
		<table cellpadding=0 cellspacing=0 width="100%">
			<tr>
				<td>
					<div v:shape="Rectangle_x0020_4">
						<p align=left>
							<span lang=EN-US style='font-size:10.0pt;font-family:"Times New Roman","serif";mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";mso-bidi-theme-font:minor-bidi;mso-font-kerning:0pt;mso-no-proof:yes'>
     							<img width=101 height=124 id="_x0000_i1025" src="$img">
							</span>
     					</p>
     				</div>
     			</td>
			</tr>
		</table>
	</span>
</p>
	
<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
		手机 : {$rs['phone']}
	</span>
</p>

<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
		E-mail : {$rs['email']}">{$rs['email']}
	</span>
</p>

<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
		自我介绍 : {$rs['jieshao']}
	</span>
</p>
	
<p style='tab-stops:366.0pt;width:2000px;background:#D9D9D9;'>
	<b style='mso-bidi-font-weight:normal'>
		<span style='font-size:15.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin;background:#D9D9D9;mso-shading:white;mso-pattern:gray-15 auto'>
			求职意向
		</span>
	</b>
	<b style='mso-bidi-font-weight:normal'>
		<span lang=EN-US style='font-size:15.0pt;background:#D9D9D9;mso-shading:white;mso-pattern:gray-15 auto'>
			<span style='mso-spacerun:yes'></span>
			<o:p></o:p>
		</span>
	</b>
</p>
EOF;
	if($rs['zt'] != 1){
		$wordStr .= '<p style="tab-stops:366.0pt"><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">简历标题:'.$rs['title'].'</span></p>';
	}
	$wordStr .= <<<EOF
<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-theme-font:minor-fareast;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-theme-font:minor-fareast'>
		求职地区:
		<span lang=EN-US style='background:#D9D9D9;mso-shading:white;mso-pattern:gray-15 auto'><o:p></o:p></span>
			$qiuzhi
		<span lang=EN-US><o:p></o:p></span>
	</span>
</p>

<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-theme-font:minor-fareast;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-theme-font:minor-fareast'>
		职位类别:
		<span lang=EN-US style='background:#D9D9D9;mso-shading:white;mso-pattern:gray-15 auto'><o:p></o:p></span>
			{$zhiwei}
		<span lang=EN-US><o:p></o:p></span>
	</span>
</p>

<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-theme-font:minor-fareast;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-theme-font:minor-fareast'>
		期望薪资:
		<span lang=EN-US style='background:#D9D9D9;mso-shading:white;mso-pattern:gray-15 auto'><o:p></o:p></span>
			{$rs['money']}{$rs['danwei']}
		<span lang=EN-US><o:p></o:p></span>
	</span>
</p>

<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-theme-font:minor-fareast;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-theme-font:minor-fareast'>
		工作经历:
		<span lang=EN-US style='background:#D9D9D9;mso-shading:white;mso-pattern:gray-15 auto'><o:p></o:p></span>
			{$rs['gzjl']}
		<span lang=EN-US><o:p></o:p></span>
	</span>
</p>
EOF;
		if($rs['zt'] == 1){
			$wordStr .= '<p style="tab-stops:366.0pt"><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">有效期:'.$rs['youxiao'].'</span></p>
						<p style="tab-stops:366.0pt"><span style="font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin">兼职时间:
						<table class="icheck">
						<thead>
						<tr>
						<th>&nbsp;</th>
						<th>星期一</th>
						<th>星期二</th>
						<th>星期三</th>
						<th>星期四</th>
						<th>星期五</th>
						<th>星期六</th>
						<th>星期日</th>
						</tr>
						</thead>
						<tbody>
						<tr>
						<th>上午</th>';
			for($i=1;$i<8;$i++){
				if(strpos($rs['jztime'],','.$i.'_1,') !== false){
					$wordStr .='<td>√</td>';
				}else{
					$wordStr .='<td></td>';
				}
			}
			$wordStr .= '</tr>
							<tr>
							<th>下午</th>';
			for($i=1;$i<8;$i++){
				if(strpos($rs['jztime'],','.$i.'_2,') !== false){
					$wordStr .='<td>√</td>';
				}else{
					$wordStr .='<td></td>';
				}
			}
			$wordStr .= '</tr>
							<tr>
							<th>晚上</th>';
			for($i=1;$i<8;$i++){
				if(strpos($rs['jztime'],','.$i.'_3,') !== false){
					$wordStr .='<td>√</td>';
				}else{
					$wordStr .='<td></td>';
				}
			}
			$wordStr .= '</tr>
							</tbody>
							</table>
							</span></p>';
		}
		$pxjl = $this->ckpxjl($uid);
		$str = '';
		if($pxjl){
			foreach ($pxjl as $k=>$v){
				$time = date('Y-m-d H:i:s',$v['time']);
				$lx = ($v['lx'] == 1) ? '视频' : '文章';
				$str .= $time.'查看了'.$v['zjname'].'发布的'.$lx.'【'.$v['spname'].'】;<br>';
			}
		}
	
	$wordStr .= <<<EOF
<p style='tab-stops:366.0pt;width:2000px;background:#D9D9D9;'>
	<b style='mso-bidi-font-weight:normal'>
		<span style='font-size:15.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin;background:#D9D9D9;mso-shading:white;mso-pattern:gray-15 auto'>
			培训经历
		</span>
	</b>
	<b style='mso-bidi-font-weight:normal'>
		<span lang=EN-US style='font-size:15.0pt;background:#D9D9D9;mso-shading:white;mso-pattern:gray-15 auto'>
			<span style='mso-spacerun:yes'></span><o:p></o:p>
		</span>
	</b>
</p>
	
<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
		{$str}
	</span>
	<span lang=EN-US style='font-size:9.0pt'><o:p></o:p></span>
</p>
				
<p style='tab-stops:366.0pt;width:2000px;background:#D9D9D9;'>
	<b style='mso-bidi-font-weight:normal'>
		<span style='font-size:15.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin;background:#D9D9D9;mso-shading:white;mso-pattern:gray-15 auto'>
			专家面试意见
		</span>
	</b>
	<b style='mso-bidi-font-weight:normal'>
		<span lang=EN-US style='font-size:15.0pt;background:#D9D9D9;mso-shading:white;mso-pattern:gray-15 auto'>
			<span style='mso-spacerun:yes'></span><o:p></o:p>
		</span>
	</b>
</p>

<p style='tab-stops:366.0pt'>
	<span style='font-size:9.0pt;font-family:宋体;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin'>
		{$zhuanjia}
	</span>
	<span lang=EN-US style='font-size:9.0pt'><o:p></o:p></span>
</p>
</div>
</body></html>
EOF;
		return $wordStr;
	}
	
	/**
	 * GET 
	 * uid 用户id（不传此项是自己下载自己简历）
	 * id 简历id
	 */
	function resume_xiazai(){//下载简历
		if(!@$this->_get('uid') || (@$this->_get('uid') && @$this->_get('uid') == $this->ruid)){
			$this->sfdl_user();
		}
		$this->_is_html=1;
		if(@$this->_get('id')){
			$uid = @$this->_get('uid') ? $this->_get('uid') : $this->ruid;
			$w = array('id'=>$this->_get('id'),'uid'=>$uid);
			$rs = C_base::M('admin.recruit')->resume_s($uid,$w);
			if($rs){
				$this->zjqyxz($uid,$this->_get('id'));
				header("Cache-Control: no-cache, must-revalidate");
				header("Pragma: no-cache");
				$wordStr = $this->resume_html($rs,$uid);
				$filename = $this->user_name($uid);
				header("Content-Type: application/doc");
				header("Content-Disposition: attachment; filename=" . $filename . ".doc");
				echo $wordStr;
			}else{
				$this->_cuowu('非法操作');
			}
		}else{
			$this->_cuowu('非法操作');
		}
	}
	
	function zjqyxz($uid,$jlid){
		$this->_is_html = 1;
		$zjid = @$this->Ses('recruit_zjid');
		if(@$zjid){  //专家下载
			$yh= C_base::M('admin.recruit')->user_s(array('id'=>$zjid));
			if($yh['lx'] == 1){  //普通专家扣除关联企业下载简历数
				if(@$yh['qyid']){
					$qid = $yh['qyid'];
					$w = array('qid'=>$yh['qyid'],'uid'=>$uid,'jlid'=>$jlid,'lx'=>1);
				}else{
					$this->_cuowu('非法操作');
				}
				$tj = C_base::M('admin.recruit')->qy_gw_tj_s(array('qid'=>$yh['qyid']));
				if (@$tj){
					if ($tj['kxzjl'] == '0') {
						die('请购买套餐!');
					}
				}else {
					die('请购买套餐!');
				}
			}elseif ($yh['lx'] == 2){ //vip专家减自己的下载简历数
				$cc = C_base::M('admin.recruit')->zjtongji_s(array('zjid'=>$zjid));
				if(@$cc){
					if($cc['yxjstime'] < time()){
						$this->_cuowu('套餐已过期，请重新购买');
					}
					if($cc['jlfs'] < 1){
						$this->_cuowu('下载简历份数不足');
					}
					$qid = $zjid;
					$w = array('qid'=>$zjid,'uid'=>$uid,'jlid'=>$jlid,'lx'=>1);
				}else{
					$this->_cuowu('非法操作');
				}
			}else{
				$this->_cuowu('非法操作');
			}
			$aa = C_base::M('admin.recruit')->jlxz_s($qid,$w);
			if(@!$aa){
				$w['time'] = time();
				$xr = C_base::M('admin.recruit')->jlxz_c($qid,$w); //写入下载表
				if($xr){
					if($yh['lx'] == 1){  //普通
						//企业下载数量-1
						C_base::con('html.firm')->gwtj($yh['qyid'],'xzjl',1);
						C_base::con('html.firm')->gwtj($yh['qyid'],'kxzjl',2);
					}else{  //vip
						C_base::M('admin.recruit')->zjtongji_u(array('zjid'=>$zjid),array('jlfs-'=>1));
					}
				}			
			}else{  //修改下载时间
				C_base::M('admin.recruit')->jlxz_u($w,array('time'=>time())); //写入下载表
			}
		}
		$qid = @$this->Ses('firm_id');
		if ($qid){
			$tj = C_base::M('admin.recruit')->qy_gw_tj_s(array('qid'=>$qid));
			if (@$tj){
				if ($tj['kxzjl'] == '0') {
					$this->_cuowu('请购买套餐!');
				}else {
					$ws = array('qid'=>$qid,'uid'=>$uid,'jlid'=>$jlid,'lx'=>'0');
					$aa = C_base::M('admin.recruit')->jlxz_s($qid,$ws);
					if(@!$aa){
						$wa = array('qid'=>$qid,'uid'=>$uid,'jlid'=>$jlid,'lx'=>'0');
						$wa['time'] = time();
						$xr = C_base::M('admin.recruit')->jlxz_c($qid,$wa); //写入下载表
						if($xr){
							C_base::con('html.firm')->gwtj($qid,'xzjl',1);
							C_base::con('html.firm')->gwtj($qid,'kxzjl',2);
						}
					}else{  //修改下载时间
						C_base::M('admin.recruit')->jlxz_u($ws,array('time'=>time())); //写入下载表
					}
				}
			}else {
				$this->_cuowu('请购买套餐!');
			}
		}
	}

/**************************************************培训经历************************************************/
	function pxjl(){//培训经历
		$this->title = '学习记录';
		$this->sfdl_user();
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		$this->rs = $this->ckpxjl($this->ruid,$page,$pagesize);
		$this->rscount = C_base::M('admin.recruit')->look_n($this->ruid,array('uid'=>$this->ruid));
		//print_r($this->rs);
	}
	
	function ckpxjl($uid,$page='',$pagesize=''){//查看培训经历
		if($page && $pagesize){
			$pxjl = C_base::M('admin.recruit')->look_ss($uid,array('uid'=>$uid),$page,$pagesize);
		}else{
			$pxjl = C_base::M('admin.recruit')->look_ss($uid,array('uid'=>$uid));
		}
		$rs = array();
		if($pxjl){
			foreach ($pxjl as $k=>$v){
				$rs[$k] = $v;
				//专家名称
				$rs[$k]['zjname'] = $this->user_name($v['zjid']);
				//视频名称
				$sp = C_base::M('admin.recruit')->sp_s($v['zjid'],array('id'=>$v['spid']));
				$rs[$k]['spname'] = @$sp['name'];
			}
		}
		return $rs;
	}
	
/**************************************************专家评价************************************************/
	function ckview($uid){//查看专家面试意见
		$rs = C_base::M('admin.recruit')->view_ss($uid,array('uid'=>$uid));
		$str = '';
		if($rs){
			foreach ($rs as $k=>$v){
				//专家名称
				$zjname = $this->user_name($v['zjid']);
				//培训经历
				$str .= '专家【'.$zjname.'】评价：'.$v['view'].';<br>';
			}
		}
		return $str;
	}
	
	function resume_pj(){//专家评价
		$this->title = '专家评价';
		C_base::con('html.job')->sfdl_zjia();
		if(!@$this->_get('uid')){
			$this->_cuowu('非法操作');
		}
		$this->uid = @$this->_get('uid');
		$this->name = $this->user_name($this->uid);
	}
	
	function add_view(){//专家给用户添加面试意见
		$this->_is_html=1;
		C_base::con('html.job')->sfdl_zjia();
		extract($this->_post());
		if(@$uid && @$view){
			$w = array('zjid'=>$this->Ses('recruit_zjid'),'uid'=>$uid);
			$pd = C_base::M('admin.recruit')->view_s($uid,$w);
			if(!@$pd){
				$this->pd_name($view,600);
				$c = array_merge($w,array('view'=>$view,'time'=>time()));
				$aa = C_base::M('admin.recruit')->view_c($uid,$c);
				if(@$aa){
					$this->user_tongji(array('uid'=>$uid,'ziduan'=>'view','type'=>'+'));
					exit('填写成功');
				}else{
					exit('系统繁忙或已经评价过了');
				}
			}else{
				exit('已填写过了');
			}
		}else{
			exit('请填写评价内容');
		}
	}
	
/**************************************************公用部分************************************************/
	function user_name($uid,$type=0){//获取用户名
		if($type == 1){//只获取注册时的账号
			$yh = C_base::M('admin.recruit')->user_s(array('id'=>$uid));
			$yhm = (@$yh['type'] == 1) ? @$yh['phone'] : @$yh['email'];
			return $yhm;
		}else{//有姓名获取姓名，没有姓名获取注册时的账号
			$user = C_base::M('admin.recruit')->ubase_s(array('uid'=>$uid));
			$yh = C_base::M('admin.recruit')->user_s(array('id'=>$uid));
			$yhm = (@$yh['type'] == 1) ? @$yh['phone'] : @$yh['email'];
			$name = @$user['name'] ? $user['name'] : $yhm;
			return $name;
		}
	}
	
	function user_dz($id){//根据地址id获取地址名称
		$rs = C_base::M('admin.port')->linkage_s(array('area_id'=>$id));
		return @$rs['area_name'] ? $rs['area_name'] : '';
	}
	
	function user_zw($id){//根据职位id获取职位名称
		$rs = C_base::M('admin.recruit')->job_s(array('id'=>$id));
		return @$rs['name'] ? $rs['name'] : '';
	}
	
	function user_zy($id){//根据专业id获取专业名称
		$rs = C_base::M('admin.recruit')->major_s(array('id'=>$id));
		return @$rs['name'] ? $rs['name'] : '';
	}
	
	/**
	 * 用户数据统计
	 * $uid	用户id
	 * $ziduan	要统计的字段
	 * $type	操作。+-
	 */
	function user_tongji($post){
		extract($post);
		$w = array('uid'=>$uid);
		$pd = C_base::M('admin.recruit')->tongji_s($w);
		if($pd){
			$x = $ziduan.$type;
			$u = array($x=>1);
			C_base::M('admin.recruit')->tongji_u($w,$u);
		}else{
			$c = array('uid'=>$uid,$ziduan=>1);
			C_base::M('admin.recruit')->tongji_c($c);
		}
	}
	
/**************************************************投递简历************************************************/
	function resume_td(){//投递简历
		$this->sfdl_user();
		$this->title='投递简历';
		$this->zid = @$this->_get('zid');
		$this->qid = @$this->_get('qid');
		$this->type = @$this->_get('type');
		//用户统计信息
		$tj = C_base::M('admin.recruit')->tongji_s(array('uid'=>$this->ruid));
		$this->shu = @$tj ? ($tj['quanzhi'] + $tj['jianzhi']) : 0;
		//简历信息
		$this->rs = C_base::M('admin.recruit')->resume_ss($this->ruid,array('uid'=>$this->ruid));
		if(@$this->rs){
			foreach ($this->rs as $k=>$v){
				$this->rs[$k]['zwname']=$this->user_zw($v['zwlb']).'('.$this->user_zw($v['zhiwei']).')';
			}
		}
		//print_r($this->rs);
	}
	
	/**
	 * 投递简历
	 * jid 简历id
	 * qid 企业id
	 * zid 企业发布岗位id
	 */
	function toudi(){//投递简历
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		if(@$jid && @$qid && @$zid){
			$w = array('jid'=>$jid,'uid'=>$this->ruid,'qid'=>$qid,'zid'=>$zid);
			$pd = C_base::M('admin.recruit')->toudi_s($this->ruid,$w);
			if(!@$pd){//第一次投递
				$c = array_merge($w,array('time'=>time()));
				$lx = (@$type == 2) ? 1 : 0;
				$aa = C_base::M('admin.recruit')->toudi_c($this->ruid,array_merge($c,array('type'=>$lx)));
				if(@$type == 2){//VIP专家发布
					$v = array('jid'=>$jid,'uid'=>$this->ruid,'zjid'=>$qid,'zid'=>$zid,'time'=>time());
					$bb = C_base::M('admin.recruit')->vtoudi_c($qid,$v);
					$cc = C_base::M('admin.recruit')->zjtongji_s(array('zjid'=>$qid));
					if($cc){
						C_base::M('admin.recruit')->zjtongji_u(array('zjid'=>$qid),array('jlwds+'=>1));
					}					
				}else{//企业发布
					$bb = C_base::M('admin.recruit')->qtoudi_c($qid,$c);
					$tj = C_base::M('admin.recruit')->qy_gw_tj_s(array('qid'=>$qid));
					if (@$tj){
						$wdjl = C_base::con('html.firm')->gwtj($qid,'wd',1);
						$wdjl = C_base::con('html.firm')->gwtj($qid,'jlzs',1);
					}else {
						$qyxr = C_base::M('admin.recruit')->qy_gw_tj_c(array('qid'=>$qid,'wd'=>'1','jlzs'=>'1'));
					}
				}
				if(@$aa){
					$this->user_tongji(array('uid'=>$this->ruid,'ziduan'=>'toudi','type'=>'+'));
				}
			}else{//投递过修改时间
				$tj = array('id'=>$pd['id']);
				$u = array('time'=>time());
				$aa = C_base::M('admin.recruit')->toudi_u($this->ruid,$tj,$u);
				if(@$type == 2){//VIP专家发布
					$v = array('jid'=>$jid,'uid'=>$this->ruid,'zjid'=>$qid,'zid'=>$zid);
					$cc = C_base::M('admin.recruit')->vtoudi_u($qid,$v,$u);
				}else{//企业发布
					$bb = C_base::M('admin.recruit')->qtoudi_u($qid,$w,$u);
				}
			}
			if(@$aa){
				exit('投递成功');
			}else{
				exit('系统繁忙或已经投递过了');
			}
		}else{
			exit('请选择投递的简历');
		}
	}
	
	/**
	 * 企业查看投递简历更改状态
	 * jid 简历id
	 * uid 用户id
	 * qid 企业id
	 * zid 岗位id
	 */
	function toudi_zt($post){//企业查看投递简历更改状态
		extract($post);
		$w = array('jid'=>$jid,'uid'=>$uid,'qid'=>$qid,'zid'=>$zid,'zt'=>0);
		$pd = C_base::M('admin.recruit')->toudi_s($uid,$w);
		$qpd = C_base::M('admin.recruit')->qtoudi_s($qid,$w);
		if($pd && $qpd){
			$tj = array('id'=>$pd['id']);
			$qtj = array('id'=>$qpd['id']);
			$u = array('zt'=>1);
			$aa = C_base::M('admin.recruit')->toudi_u($uid,$tj,$u);
			$bb = C_base::M('admin.recruit')->qtoudi_u($qid,$qtj,$u);
			C_base::con('html.firm')->gwtj($qid,'wd','2');
		}
	}
	
	/**
	 * 专家查看投递简历更改状态
	 * jid 简历id
	 * uid 用户id
	 * zjid 专家id
	 * zid 岗位id
	 */
	function vtoudi_zt($post){//专家查看投递简历更改状态
		extract($post);
		$w = array('jid'=>$jid,'uid'=>$uid,'qid'=>$zjid,'zid'=>$zid,'zt'=>0);
		$pd = C_base::M('admin.recruit')->toudi_s($uid,$w);
		$w1 = array('jid'=>$jid,'uid'=>$uid,'zjid'=>$zjid,'zid'=>$zid,'zt'=>0);
		$qpd = C_base::M('admin.recruit')->vtoudi_s($zjid,$w1);
		if($pd && $qpd){
			$tj = array('id'=>$pd['id']);
			$qtj = array('id'=>$qpd['id']);
			$u = array('zt'=>1);
			$aa = C_base::M('admin.recruit')->toudi_u($uid,$tj,$u);
			$bb = C_base::M('admin.recruit')->vtoudi_u($zjid,$qtj,$u);
		}
	}
	
/**************************************************职位申请历史************************************************/
	function apply(){//职位申请历史
		$this->title = '应聘记录';
		$this->sfdl_user();
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		$this->rs = C_base::M('admin.recruit')->toudi_ss($this->ruid,array('uid'=>$this->ruid),$page,$pagesize);
		if($this->rs['data']){
			foreach ($this->rs['data'] as $k=>$v){
				$jl = C_base::M('admin.recruit')->resume_s($v['uid'],array('id'=>$v['jid']));
				$this->rs['data'][$k]['jlname'] = ($jl['zt'] == 0) ? $jl['title'] : $this->user_zw($jl['zwlb']).'('.$this->user_zw($jl['zhiwei']).')';
				$zw = C_base::M('admin.recruit')->qy_gw_s($v['qid'],array('id'=>$v['zid']));
				if(@$zw['qy_name']){
					$this->rs['data'][$k]['qyname'] = $zw['qy_name'];
				}else{
					$qyname = C_base::M('admin.recruit')->qys_s(array('uid'=>$v['qid']));
					$this->rs['data'][$k]['qyname'] = @$qyname['qy_name'];
				}
				$this->rs['data'][$k]['gwname'] = @$zw['name'] ? $zw['name'] : '此岗位已失效';
			}
		}
	}
	
	function apply_del(){//删除应聘记录
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		if(@$id){
			$sz = array_filter(explode(',', $id));
			if(@$sz){
				foreach ($sz as $k=>$v){
					$w = array('id'=>$v,'uid'=>$this->ruid);
					$pd = C_base::M('admin.recruit')->toudi_s($this->ruid,$w);
					if($pd){
						$aa = C_base::M('admin.recruit')->toudi_d($this->ruid,$w);
						if($aa){
							$this->user_tongji(array('uid'=>$this->ruid,'ziduan'=>'toudi','type'=>'-'));
						}
					}
				}
			}
			if(@$aa){
				exit('删除成功');
			}else{
				exit('系统繁忙');
			}
		}else{
			exit('请选择删除对象');
		}
	}
	
/**************************************************职位收藏************************************************/
	function user_sc($uid,$page='',$pagesize=''){
		if($page && $pagesize){
			$sc = C_base::M('admin.recruit')->shoucang_ss($uid,array('uid'=>$uid),$page,$pagesize);
		}else{
			$sc = C_base::M('admin.recruit')->shoucang_ss($uid,array('uid'=>$uid));
		}
		if($sc){
			foreach ($sc as $k=>$v){
				$zw = C_base::M('admin.recruit')->qy_gw_s($v['qid'],array('id'=>$v['zid']));
				if(@$zw['qy_name']){
					$sc[$k]['qyname'] = $zw['qy_name'];
				}else{
					$qyname = C_base::M('admin.recruit')->qys_s(array('uid'=>$v['qid']));
					$sc[$k]['qyname'] = @$qyname['qy_name'];
				}
				$sc[$k]['zwname'] = @$zw['name'] ? $zw['name'] : '此岗位已失效';
			}
		}
		return $sc;
	}
	
	function sc(){//收藏职位
		$this->title = '职位收藏';
		$this->sfdl_user();
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		$this->rs = $this->user_sc($this->ruid,$page,$pagesize);
		$this->rscount = C_base::M('admin.recruit')->shoucang_n($this->ruid,array('uid'=>$this->ruid));
	}
	
	function sc_add(){//加入收藏
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		if(@$zid && @$qid){
			$lx = (@$type == 2) ? 1 : 0;
			$w = array('zid'=>$zid,'qid'=>$qid,'type'=>$lx,'uid'=>$this->ruid);
			$pd = C_base::M('admin.recruit')->shoucang_s($this->ruid,$w);
			if(!@$pd){
				$c = array_merge($w,array('time'=>time()));
				$aa = C_base::M('admin.recruit')->shoucang_c($this->ruid,$c);
				if($aa){
					exit('收藏成功');
				}else{
					exit('系统繁忙');
				}
			}else{
				exit('已收藏');
			}
		}else{
			exit('请选择收藏对象');
		}
	}
	
	function sc_del(){//取消收藏
		$this->_is_html=1;
		$this->sfdl_user();
		extract($this->_post());
		if(@$id){
			$sz = array_filter(explode(',', $id));
			if(@$sz){
				foreach ($sz as $k=>$v){
					$w = array('id'=>$v,'uid'=>$this->ruid);
					$pd = C_base::M('admin.recruit')->shoucang_s($this->ruid,$w);
					if($pd){
						$aa = C_base::M('admin.recruit')->shoucang_d($this->ruid,$w);
					}
				}
			}
			if(@$aa){
				exit('删除成功');
			}else{
				exit('系统繁忙');
			}
		}else{
			exit('请选择删除对象');
		}
	}
	
/**************************************************职位推荐************************************************/
	function user_tj($uid){//最新职位推荐
		$rs = C_base::M('admin.recruit')->resume_ss($uid,array('uid'=>$uid));
		$zw = array();
		if($rs){
			foreach ($rs as $k=>$v){
				$zw[] = $v['zwlb'];
			}
		}
		$zw  = array_values(array_unique($zw));
		$r = array();
		for($i=0;$i<10;$i++){
			$r[$i] = C_base::M('admin.recruit')->qy_gw_ss($i,array('issue'=>1));
		}
		$gw = $tj = $xgw = array();
		$gw = util::arr_one($r);
		if($gw){
			foreach ($gw as $k=>$v){
				if($zw && in_array($v['zwlb'], $zw)){
					$tj[]=$v;
				}else{
					$xgw[]=$v;
				}
			}
		}
		$lie = 10;
		$shu = $lie - count($tj);
		if(count($xgw) <= $shu){//如果剩下的条数小于等于要筛选的条数，直接获取
			foreach ($xgw as $k=>$v){
				$tj[]=$v;
			}
		}elseif(count($tj) != $lie){
			if(count($tj) > $lie){//如果推荐的条数大于十条，则随机抽取
				$xgw = $tj;
				$tj = array();
			}
			if($shu <= 1){
				$sj = array_rand($xgw);
				$tj[] = $xgw[$sj];
			}else{
				$sj = array_rand($xgw,$shu);
				foreach ($sj as $k=>$v){
					$tj[]=$xgw[$v];
				}
			}
		}
		if($tj){
			$tj = util::unique_arr($tj,true);//去重
			$tj = util::paixu($tj,'time','desc');//排序
		}
		return $tj;
	}
	
/**************************************************通知************************************************/
	function tz(){//系统通知
		$this->title = '系统通知';
		$this->sfdl_user();
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		//后台客服推送文章/视频
		if(@$this->_get('type') == 1){//所有
			$w = array('uid'=>$this->ruid);
		}else{//未读
			$w = array('uid'=>$this->ruid,'type'=>0);
		}
		$rs = C_base::M('admin.recruit')->tz_ss($this->ruid,$w);
		$this->rs = array();
		if($rs){
			$rs = util::paixu($rs,'time','desc');//排序
			$rs = util::fenye($rs,$page,$pagesize);//分页
			foreach ($rs as $k=>$v){
				$this->rs[$k] = $v;
				//视频信息
				$this->rs[$k]['sp'] = C_base::M('admin.recruit')->sp_s($v['zjid'],array('id'=>$v['spid']));
				//专家信息
				$this->rs[$k]['zjbase'] = C_base::con('html.job')->zzxx($v['zjid']);
			}
		}
		$this->rscount = C_base::M('admin.recruit')->tz_n($this->ruid,$w);
		
	}
	
	/**
	 * 查看通知改变状态
	 * $id 通知id
	 */
	function tzxx($id){//查看通知改变状态
		$this->sfdl_user();
		$rs = C_base::M('admin.recruit')->tz_s($this->ruid,array('id'=>$id));
		if(@$rs && @$rs['type'] == 0){//如果还是未读状态再执行，否则不需要操作
			C_base::M('admin.recruit')->tz_u($this->ruid,array('id'=>$id),array('type'=>1));
			//未读推荐数-1
			$this->user_tongji(array('uid'=>$this->ruid,'ziduan'=>'tuijian','type'=>'-'));
		}
	}
/**************************************************积分充值************************************************/
	function czjf(){//充值积分
		$this->title = '积分充值';
		$this->sfdl_user();
	}
	
	function czjfxz(){//充值积分
		$this->title = '积分充值选择方式';
		$this->sfdl_user();
		if(@$this->_get('jifen')){
			if(!@is_numeric($this->_get('jifen'))){
				$this->_cuowu('积分必须为数字格式');
			}else{
				$this->jifen = @$this->_get('jifen');
				//积分充值成功后调用changelevel()方法，改变用户等级
				if(@$this->jifen ){
					if(@$this->jifen  < 0 || @!preg_match('/^[0-9]*$/', $this->jifen )){
						exit('总金额必须为整数');
					}
				}
				$this->wx = C_base::con('html.weixin')->get_signature();
				$this->type = 'SHA1';//SHA1、MD5
				$body = '';//商品描述
				$out_trade_no = '11';//商户订单号
				$total_fee = $this->jifen;//总金额（以分为单位）
				$spbill_create_ip = '';//终端IP
				$notify_url = 'http：//www.sky9001.com';//通知地址，接收微信支付异步通知回调地址
				

				$partner = time(); //订单
				$sign = '';
				//$this->xd = 'addition='.$addition.'&bank_type=WX&body='.$body.'&fee_type=CNY&input_charset=GBK&notify_url='.$notify_url.'&out_trade_no='.$out_trade_no.'&partner='.$partner.'&spbill_create_ip='.$spbill_create_ip.'&total_fee='.$total_fee.'&sign='.$sign;
				$xd = 'bank_type=WX&body='.'微信测试'.'&fee_type=CNY&input_charset=GBK&notify_url='.$notify_url.'&out_trade_no='.$out_trade_no.'&partner='.$partner.'&spbill_create_ip='.$spbill_create_ip.'&total_fee='.$total_fee.'&sign='.$sign;				
				$this->xd = urlencode($xd); 
			}
		}else{
			$this->_cuowu('请填写充值积分');
		}
	}
	

	function sys(){  //微信充值
		if(@$this->_get('jifen')){
			$money = $this->_get('jifen')*10;
		}else{
			exit('error');
		}
		C_base::yn_file('base'.DS.'ceshi'.DS.'WxPayPubHelper'.DS.'WxPayPubHelper.php');	
		//使用统一支付接口
		$unifiedOrder = new UnifiedOrder_pub();
		//设置统一支付接口参数
		//设置必填参数
		//appid已填,商户无需重复填写
		//mch_id已填,商户无需重复填写
		//noncestr已填,商户无需重复填写
		//spbill_create_ip已填,商户无需重复填写
		//sign已填,商户无需重复填写
		$unifiedOrder->setParameter("body","积分充值");//商品描述
		//自定义订单号，此处仅作举例
		$out_trade_no = 'wxcz-'.$this->ruid.'-'.$this->_get('jifen').'-'.time();
		//$out_trade_no = WxPayConf_pub::APPID."$timeStamp";
		$unifiedOrder->setParameter("out_trade_no","$out_trade_no");//商户订单号
		$unifiedOrder->setParameter("total_fee",$money);//总金额
		$unifiedOrder->setParameter("notify_url",WxPayConf_pub::NOTIFY_URL);//通知地址
		$unifiedOrder->setParameter("trade_type","NATIVE");//交易类型		
		//获取统一支付接口结果
		$unifiedOrderResult =$this->unifiedOrderResult= $unifiedOrder->getResult();
		//商户根据实际情况设置相应的处理流程
		if ($unifiedOrderResult["return_code"] == "FAIL")
		{
			//商户自行增加处理流程
			echo "通信出错：".$unifiedOrderResult['return_msg']."<br>";
		}
		elseif($unifiedOrderResult["result_code"] == "FAIL")
		{
			//商户自行增加处理流程
			echo "错误代码：".$unifiedOrderResult['err_code']."<br>";
			echo "错误代码描述：".$unifiedOrderResult['err_code_des']."<br>";
		}
		elseif($unifiedOrderResult["code_url"] != NULL)
		{
			//从统一支付接口获取到code_url
			$this->code_url = $unifiedOrderResult["code_url"];
			//商户自行增加处理流程
			//......
		}
	}
	
	function zfbcz(){  //支付宝充值
		require_once ('../sys/base/zfb/alipay.config.php');
		require_once ('../sys/base/zfb/lib/alipay_submit.class.php');
		$jifen = $this->_post('jifen');
		if(@!$jifen){
			exit('系统异常');
		}else{
			if(!$this->ruid){
				exit('系统异常');
			}
			if(@$jifen){
				$money = $jifen/10;
			}else{
				exit('error');
			}
			$out_trade_no = 'alipay-'.$this->ruid.'-'.$jifen.'-'.time();
			$parameter = array(
				"service" => "create_direct_pay_by_user",
				"partner" => trim($alipay_config['partner']),
				"seller_email" => trim($alipay_config['seller_email']),
				"payment_type"	=> 1, //支付类型 不能修改
				"notify_url"	=> 'http://www.sky9001.com/notify_url.php', //服务器异步通知页面路径
				"return_url"	=> 'http://www.sky9001.com/?act=ruser', //页面跳转同步通知页面路径
				"out_trade_no"	=> $out_trade_no, //商户订单号
				"subject"	=> '积分充值', //订单名称
				"total_fee"	=> $money, //付款金额
				"body"	=> $jifen.'积分', //订单描述
				"_input_charset" => trim(strtolower($alipay_config['input_charset'])) //字符编码格式 目前支持 gbk 或 utf-8
			);
			$alipaySubmit = new AlipaySubmit($alipay_config);
			$html_text = $alipaySubmit->buildRequestForm($parameter,"get", "下一步",1);
			print_r($html_text);exit;
		}
	}
	
	function changelevel($uid,$jifen,$lx='0'){//根据积分改变等级
		$pays = C_base::M('admin.recruit')->pay_c($uid,array('uid'=>$uid,'jifen'=>$jifen,'lx'=>$lx,'time'=>time()));
		$js = C_base::M('admin.recruit')->user_u(array('id'=>$uid),array('jifen+'=>$jifen,'pay+'=>$jifen));
		$user = C_base::M('admin.recruit')->user_s(array('id'=>$uid));
		$pay = $user['pay'];//充值总积分
		if($pay < 10){
			$level = 0;
		}elseif($pay >= 10 && $pay < 20){
			$level = 1;
		}elseif($pay >= 20 && $pay < 30){
			$level = 2;
		}elseif($pay >= 30 && $pay < 50){
			$level = 3;
		}elseif($pay >= 50 && $pay < 100){
			$level = 4;
		}elseif($pay >= 100 && $pay < 150){
			$level = 5;
		}elseif($pay >= 150 && $pay < 200){
			$level = 6;
		}else{
			$level = 7;
		}
		$aa = C_base::M('admin.recruit')->user_u(array('id'=>$uid),array('level'=>$level));
		return $aa;
	}
/**************************************************找工作、找兼职************************************************/
	function sousuo(){//搜索
		$this->zwlb = C_base::M('admin.recruit')->job_ss(array('sid'=>0));//职位类别
		if($this->zwlb){
			foreach ($this->zwlb as $k=>$v){
				$this->zwlb[$k]['xiao'] = C_base::M('admin.recruit')->job_ss(array('sid'=>$v['id']));
			}
		}
		$this->hy = C_base::M('admin.recruit')->industry_ss();//行业类别
		$this->dz = C_base::M('admin.port')->linkage_ss(array('parent_id'=>'0'));//省
		if(@$this->dz){
			foreach ($this->dz as $k=>$v){
				$this->dz[$k]['xiaji'] = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$v['area_id']));//市	
			}
		}
		$this->mh = @$this->_get('mh') ? $this->_get('mh') : 'qyname';
		$this->sid = $sid = @$this->_get('shi') ? $this->_get('shi') : '410100';//郑州市
		$this->sname = @$this->user_dz($sid);
		$this->dzs = C_base::M('admin.port')->linkage_ss(array('parent_id'=>$sid));
		
	}
	
	function sousuors($rs=array(),$page='',$pagesize=''){
		$rss = array();
		if($rs){
			$rss['count'] = count($rs);
			$rs = util::paixu($rs,'utime','desc');//排序
			$rs = util::fenye($rs,$page,$pagesize);//分页
			foreach ($rs as $k=>$v){
				$rss['data'][$k] = $v;
				$rss['data'][$k]['time'] = util::time_date($v['time']);
				if($v['style'] == 2){//vip专家
					$base = C_base::M('admin.recruit')->vbase_s(array('uid'=>$v['qid']));//企业账号信息
					$rss['data'][$k]['qybase']['sheng'] = @$this->user_dz($base['xsheng']);
					$rss['data'][$k]['qybase']['shi'] = @$this->user_dz($base['xshi']);
					$rss['data'][$k]['qybase']['qu'] = @$this->user_dz($base['xqu']);
					$rss['data'][$k]['qybase']['address'] = @$base['xsq'];
					$rss['data'][$k]['qybase']['logo'] = @$base['touxiang'];
				}else{//企业
					$base = C_base::M('admin.recruit')->qys_s(array('uid'=>$v['qid']));//企业账号信息
					$rss['data'][$k]['qybase']['sheng'] = @$this->user_dz($base['sheng']);
					$rss['data'][$k]['qybase']['shi'] = @$this->user_dz($base['shi']);
					$rss['data'][$k]['qybase']['qu'] = @$this->user_dz($base['qu']);
					$rss['data'][$k]['qybase']['address'] = @$base['address'];
					$rss['data'][$k]['qybase']['logo'] = @$base['logo'];
				}
			}
		}
		return $rss;
	}
	
	function quanzhi(){//找工作
		$this->title ='找工作';
		$this->sousuo();
		
	}
	
	function qzlist(){//找工作
		$this->title ='找工作';
		$this->sousuo();
		if(!@$this->_get()){
			$this->_cuowu('请选择搜索项');
		}
		extract($this->_get());
		$w = array('zt'=>0,'issue'=>1);
		if(@$mh && @$key){//关键词搜索
			if($mh == 'qyname'){//企业名称模糊搜索
				$w['qy_name?'] = $key;
			}else{//职位名称模糊搜索
				$w['name?'] = $key;
			}
		}
		if(@$hylb){//行业类别
			$w['sshy'] = $hylb;
		}
		if(@$zwlb){//职位类别
			$w['zwlb'] = $zwlb;
		}
		if(@$zhiwei){//职位类别
			$w['zhiwei'] = $zhiwei;
		}
		if(@$qyxz){//企业性质
			$w['qyxz'] = $qyxz;
		}
		if(@$shi){//市
			$w['shi'] = $shi;
		}
		if(@$qu){//区
			$w['qu'] = $qu;
		}
		if(@$yxfw){//月薪范围
			$w['money'] = $yxfw;
		}
		if(@$xueli){//学历要求
			$w['xueli'] = $xueli;
		}
		if(@$fbsj){//发布时间
			$w['time]'] = time()-$fbsj*3600*24;
		}
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		if(count($w) > 2){
			$r = array();
			for($i=0;$i<10;$i++){
				$r[$i] = C_base::M('admin.recruit')->qy_gw_ss($i,$w);
			}
			$rs = util::arr_one($r);
			$this->rs = $this->sousuors($rs,$page,$pagesize);
		}else{
			$this->_cuowu('搜索内容不能为空');
		}
	}
	
	function jianzhi(){//找兼职
		$this->title = '找兼职';
		$this->sousuo();
		
	}
	
	function jzlist(){//找兼职
		$this->title ='找兼职';
		$this->sousuo();
		if(!@$this->_get()){
			$this->_cuowu('请选择搜索项');
		}
		extract($this->_get());
		$w = array('zt'=>1,'issue'=>1);
		if(@$mh && @$key){//关键词搜索
			if($mh == 'qyname'){//企业名称模糊搜索
				$w['qy_name?'] = $key;
			}else{//职位名称模糊搜索
				$w['name?'] = $key;
			}
		}
		if(@$hylb){//行业类别
			$w['sshy'] = $hylb;
		}
		if(@$zwlb){//职位类别
			$w['zwlb'] = $zwlb;
		}
		if(@$zhiwei){//职位类别
			$w['zhiwei'] = $zhiwei;
		}
		if(@$shi){//市
			$w['shi'] = $shi;
		}
		if(@$qu){//区
			$w['qu'] = $qu;
		}
		if(@$yxfw){//月薪范围
			$w['money'] = $yxfw;
		}
		if(@$xueli){//学历要求
			$w['xueli'] = $xueli;
		}
		if(@$fbsj){//发布时间
			$w['time]'] = time()-$fbsj*3600*24;
		}
		if(@$jzsj){//兼职时间
			if(@$jzsd){//上午/下午/晚上
				$jzsd = array_filter(explode(',', $jzsd));
			}else{//全天
				$jzsd = array('1','2','3');
			}
			$jzsj = array_filter(explode(',', $jzsj));
			$jztime = array();
			foreach ($jzsd as $kk=>$vv){
				foreach ($jzsj as $k=>$v){
					$jztime[] = $v.'_'.$vv;
				}
			}
			if($jztime){
				$shu = count($jztime);
				foreach ($jztime as $k=>$v){
					$c = 'w'.$k;
					$$c = array('jztime?'=>','.$v.',');
				}
			}
		}
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		if(count($w) > 2 || (count($w) > 1 && @$jztime)){
			$r = array();
			for($i=0;$i<10;$i++){
				if(@$jztime){//兼职时间搜索
					$shu = count($jztime) - 1;
					$wo = array();
					for($j=1;$j<=$shu;$j++){
						$n = 'w'.$j;
						$wo[]= array_merge($w,$$n);
					}
					$w = array_merge($w,$w0);
					$r[$i] = C_base::M('admin.recruit')->qy_gw_sso($i,$w,$wo);
				}else{
					$r[$i] = C_base::M('admin.recruit')->qy_gw_ss($i,$w);
				}
			}
			$rs = util::arr_one($r);
			$this->rs = $this->sousuors($rs,$page,$pagesize);
		}else{
			$this->_cuowu('搜索内容不能为空');
		}
	}
	
/**************************************************我要学习************************************************/
	function xuedy($w=array()){
		$rs = array();
		if($w){
			$r = array();
			for($i=0;$i<10;$i++){
				$r[$i] = C_base::M('admin.recruit')->sp_ss($i,$w);
			}
			$rs = util::arr_one($r);
		}
		return $rs;
	}
	
	function xuers($rs=array(),$page='',$pagesize=''){
		$rss = array();
		if($rs){
			$rss['count'] = count($rs);
			$rs = util::paixu($rs,'time','desc');//排序
			$rs = util::fenye($rs,$page,$pagesize);//分页
			foreach ($rs as $k=>$v){
				$rss['data'][$k] = $v;
				$rss['data'][$k]['zjbase'] = C_base::con('html.job')->zzxx($v['zjid']);
			}
		}
		return $rss;
	}
	
	function xuexi(){
		$this->title = '我要学习';
		//热门推荐
		$tuijian = $this->xuedy(array('tuijian'=>1,'zt'=>1));
		$this->tuijian = $this->xuers($tuijian,1,8);
		//最新课程
		$new = $this->xuedy(array('zt'=>1));
		$this->new = $this->xuers($new,1,8);
		//免费课程
		$ling = $this->xuedy(array('jifen'=>0,'zt'=>1));
		$this->ling = $this->xuers($ling,1,8);
	}
	
	function xuelist(){
		$this->title = '我要学习';
		$page = $this->page = @$this->_get('page') ? $this->_get('page') : 1;
		$pagesize = $this->pagesize = 10;
		$w = array();
		if(@$this->_get('title')){//搜索关键词
			$w = array('name?'=>$this->_get('title'),'zt'=>1);
			if(@$this->_get('type') == 0){
				$w['shipin'] = '';
			}else{
				$w['shipin!'] = '';
			}
		}elseif(@$this->_get('tuijian')){//热门推荐
			$w = array('tuijian'=>1,'zt'=>1);
		}elseif(@$this->_get('new')){//最新课程
			$w = array('zt'=>1);
		}elseif(@$this->_get('ling')){//免费课程
			$w = array('jifen'=>0,'zt'=>1);
		}
		$rs = $this->xuedy($w);
		$this->rs = $this->xuers($rs,$page,$pagesize);
		
	}
	
}